import React, { Component } from "react";
import { $pre } from "../../../../http/http";
import { reqgetbanner } from "../../../../http/api";
import { Swiper } from "antd-mobile";
import "../../home.less";
export default class banner extends Component {
  constructor() {
    super();
    this.state = {
      banner: [],
    };
  }
  componentDidMount() {
    reqgetbanner().then((res) => {
      this.setState({
        banner: res.data.list,
      });
    });
  }

  render() {
    let { banner } = this.state;
    return (
      <div>
        <div className="bans" >
          <Swiper autoplay style={{ "--height": "3.8rem" }} >
            {banner.map((item) => {
              return (
                <Swiper.Item  key={item.id}>
                  <img src={$pre + item.img}  alt="" />
                </Swiper.Item>
              );
            })}
          </Swiper>
        </div>
      </div>
    );
  }
}
